package com.situ.student.service.impl;

import com.situ.student.dao.IUserDao;
import com.situ.student.dao.impl.UserDaoImpl;
import com.situ.student.entity.User;
import com.situ.student.service.IUserService;
import com.situ.student.util.MD5Util;

public class UserServiceImpl implements IUserService {
	private IUserDao userDao = new UserDaoImpl();
	
	@Override
	public User login(String name, String password) {
		User user= userDao.login(name, MD5Util.EncodeUtf8(password));
		return user;
	}

	@Override
	public boolean insert(User user) {
		user.setPassword(MD5Util.EncodeUtf8(user.getPassword()));
		int count = userDao.insert(user);
		return count > 0 ? true : false;
	}
}
